package com.sright.bcard.content.biz.manager.impl;

import com.alibaba.fastjson.JSON;
import com.sright.bcard.common.biz.manager.ContentCheckManager;
import com.sright.bcard.common.service.share.constants.RedisKeyConstants;
import com.sright.bcard.common.service.share.dto.LoginUser;
import com.sright.bcard.common.service.share.dto.content.CardDTO;
import com.sright.bcard.common.service.share.dto.content.CardUserCompanyInfoDTO;
import com.sright.bcard.common.service.share.dto.content.MyPageDTO;
import com.sright.bcard.common.service.share.dto.page.PageDTO;
import com.sright.bcard.common.service.share.dto.request.TextCheckRequest;
import com.sright.bcard.common.service.share.enums.SourceTypeEnum;
import com.sright.bcard.common.service.share.exception.base.BusinessErrorException;
import com.sright.bcard.common.service.share.exception.code.BusinessCode;
import com.sright.bcard.common.service.share.utils.*;
import com.sright.bcard.content.biz.manager.UserManager;
import com.sright.bcard.content.dal.dao.*;
import com.sright.bcard.content.dal.entity.*;
import com.sright.bcard.content.dal.query.CardListParamQuery;
import com.sright.bcard.content.dal.result.CardListResult;
import com.sright.bcard.content.dal.result.UserDetailResult;
import com.sright.bcard.common.service.share.dto.content.AdminDTO;
import com.sright.bcard.content.share.request.CardSaveParam;
import com.sright.bcard.content.share.service.TextCheckService;
import com.sright.bcard.enterprise.dal.dao.AddressDAO;
import com.sright.bcard.enterprise.dal.dao.CompanyDAO;
import com.sright.bcard.enterprise.dal.dao.EnterpriseDAO;
import com.sright.bcard.enterprise.dal.entity.AddressDO;
import com.sright.bcard.enterprise.dal.entity.CompanyDO;
import com.sright.bcard.enterprise.dal.entity.EnterpriseDO;
import com.sright.bcard.common.service.share.dto.enterprise.AddressDTO;
import com.sright.bcard.common.service.share.dto.enterprise.EnterpriseDTO;
import com.sright.bcard.enterprise.share.request.CardListParam;
import com.sright.bcard.enterprise.share.response.CardListResponse;
import com.sright.bcard.enterprise.share.response.UserDetailResponse;
import com.sright.bcard.enterprise.share.service.EnterpriseService;
import com.sright.bcard.user.dal.dao.AdminDAO;
import com.sright.bcard.user.dal.dao.MemberDAO;
import com.sright.bcard.user.dal.entity.AdminDO;
import com.sright.bcard.user.dal.entity.MemberDO;
import com.sright.bcard.user.share.request.TokenParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

@Component
@Slf4j
public class UserManagerImpl implements UserManager {

    @Autowired
    private UserDAO userDAO;

    @Autowired
    private EnterpriseService enterpriseService;

    @Autowired
    private JedisUtil jedisUtil;

    @Autowired
    private AdminDAO adminDAO;

    @Autowired
    private EnterpriseDAO enterpriseDAO;

    @Autowired
    private CardDAO cardDAO;

    @Autowired
    private CardBaseInfoDAO cardBaseInfoDAO;

    @Autowired
    private MemberDAO memberDAO;

    @Autowired
    private FavoriteCardDAO favoriteCardDAO;

    @Autowired
    private MessageDAO messageDAO;

    @Autowired
    private CardUserInfoDAO cardUserInfoDAO;

    @Autowired
    private AddressDAO addressDAO;

    @Autowired
    private CardUserCompanyInfoDAO cardUserCompanyInfoDAO;

    @Autowired
    private CompanyDAO companyDAO;

    @Autowired
    private ContentCheckManager contentCheckManager;

    @Autowired
    private TextCheckService textCheckService;

    @Autowired
    private UserInfoCheckResultDAO userInfoCheckResultDAO;

    @Override
    @Transactional(rollbackFor = Throwable.class)
    public Long save(CardSaveParam param) {
        Long enterpriseId = param.getEnterpriseId();
        if (enterpriseId == null) {
            throw new BusinessErrorException(BusinessCode.ACCOUNT_ENTERPRISE_EXCEPTION);
        }

        EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseDTO(param.getEnterpriseId());
        if (enterpriseDTO == null) {
            throw new BusinessErrorException(BusinessCode.ACCOUNT_ENTERPRISE_NOT_EXIST);
        }
        List<UserDO> userDOS = userDAO.selectByEnterpriseId(param.getEnterpriseId());
        if(CollectionUtils.isNotEmpty(userDOS) && userDOS.size() >= enterpriseDTO.getCardNum() ) {
            throw new BusinessErrorException(BusinessCode.ENTERPRISE_STAFF_LIMIT);
        }

        // 构建user
        UserDO userDO = new UserDO();
        userDO.setEnterpriseId(param.getEnterpriseId());
        Long userId = userDAO.insertSelective(userDO);

        TextCheckRequest request = new TextCheckRequest();
        request.setName(param.getName());
        request.setDepartment(param.getDepartment1Name());
        request.setJob(param.getJob1Name());
        request.setOtherDepartment(param.getDepartment2Name());
        request.setOtherJob(param.getJob2Name());
        request.setUserId(userId);

        textCheckService.textCheck(request,param.getEnterpriseId(), SourceTypeEnum.ENTERPRISE_BACKEND.getValue());

        // 构建card_user_info
        CardUserInfoDO cardUserInfoDO = new CardUserInfoDO();
        cardUserInfoDO.setUserId(userId);
        cardUserInfoDO.setName(param.getName());
        cardUserInfoDO.setNameEn(param.getNameEn());
        cardUserInfoDO.setMobile(param.getMobile1());
        cardUserInfoDO.setAddressId(param.getAddressId());
        cardUserInfoDO.setEmail(param.getEmail());
        Long cardUserInfoId = cardUserInfoDAO.insertSelective(cardUserInfoDO);
        // 构建card_user_company_info
        // 公司1
        CardUserCompanyInfoDO cardUserCompanyInfoDO1 = new CardUserCompanyInfoDO();
        cardUserCompanyInfoDO1.setCompanyId(param.getCompany1());
        cardUserCompanyInfoDO1.setJob(param.getJob1Name());
        cardUserCompanyInfoDO1.setDepartment(param.getDepartment1Name());
        cardUserCompanyInfoDO1.setCardUserInfoId(cardUserInfoId);
        cardUserCompanyInfoDAO.insertSelective(cardUserCompanyInfoDO1);
        // 公司2
        CardUserCompanyInfoDO cardUserCompanyInfoDO2 = new CardUserCompanyInfoDO();
        cardUserCompanyInfoDO2.setCompanyId(param.getCompany2());
        cardUserCompanyInfoDO2.setJob(param.getJob2Name());
        cardUserCompanyInfoDO2.setDepartment(param.getDepartment2Name());
        cardUserCompanyInfoDO2.setCardUserInfoId(cardUserInfoId);
        cardUserCompanyInfoDAO.insertSelective(cardUserCompanyInfoDO2);
        return userId;
    }

    @Override
    public List getJoinCount(LoginUser loginUser) {
        Long enterpriseId = loginUser.getEnterpriseId();
        if (enterpriseId == null) {
            throw new BusinessErrorException(BusinessCode.ACCOUNT_ENTERPRISE_EXCEPTION);
        }

        List<String> days = new ArrayList<>();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat dateFormat2 = new SimpleDateFormat("MM.dd");
        SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date nowDate = new Date();
        for (int i = 0; i < 7; i++) {
            Calendar rightNow = Calendar.getInstance();
            rightNow.setTime(nowDate);
            rightNow.add(Calendar.DAY_OF_YEAR, -i);
            Date date = rightNow.getTime();
            String day = dateFormat.format(date);
            days.add(day);
        }

        List<UserDO> users = userDAO.selectByEnterpriseId(enterpriseId);
        if (users == null || users.size() == 0) {
//            return SrightResponse.defaultSuccess();
        }

        List result = new ArrayList();
        for (String day: days) {
            Map map = new HashMap();
            map.put("date", day);
            map.put("format", day);
            String begin = day + " 00:00:00";
            String end = day + " 23:59:59";
            try {
                Date beginDate = dateFormat3.parse(begin);
                Date endDate = dateFormat3.parse(end);
                String format = dateFormat2.format(beginDate);
                map.put("format", format);

                List<UserDO> usersInDay =
                        users.stream().filter(userDO -> userDO.getCreatedAt().getTime() > beginDate.getTime() && userDO.getCreatedAt().getTime() < endDate.getTime()).collect(Collectors.toList());
                List<UserDO> members =
                        usersInDay.stream().filter(userDO -> userDO.getMemberId() > 0).collect(Collectors.toList());
                map.put("num01", usersInDay.size());
                map.put("num02", members.size());
            }
            catch (Exception exception) {
                map.put("num01", 0);
                map.put("num02", 0);
            }
            finally {
                result.add(map);
            }
        }

        return result;
    }

    @Override
    public Boolean resetPassword(AdminDTO adminDTO) {
        // 重置密码是在不知道旧的密码的情况下进行操作
        // 数据校验 判断新密码和确认密码是否一致
        if(StringUtils.isEmpty(adminDTO.getPassword()) || StringUtils.isEmpty(adminDTO.getComfirmPassword())) {
            throw new BusinessErrorException(BusinessCode.PARAM_ERROR);
        }
        if(!adminDTO.getPassword().equals(adminDTO.getComfirmPassword())) {
            throw new BusinessErrorException(BusinessCode.PWD_REPEAT_ERROR);
        }
        // 1.根据手机号查询企业信息
        EnterpriseDO enterpriseDO = enterpriseDAO.selectByMobile(adminDTO.getMobile());
        if(enterpriseDO == null) {
            throw new BusinessErrorException(BusinessCode.ACCOUNT_ENTERPRISE_NOT_EXIST);
        }
        // 2.获取企业id查询admin的信息
        AdminDO adminDO = adminDAO.selectByEnterpriseId(enterpriseDO.getId());
        if(adminDO == null) {
            throw new BusinessErrorException(BusinessCode.ENTERPRISE_NOT_EXIST);
        }
        // 3.修改密码
        // 要经过MD5加密
        String salt = SaltUtils.getSalt(6);
        String newHashPassword = BcryptUtils.hashpw(adminDTO.getComfirmPassword() + "&" + salt);
        adminDO.setSalt(salt);
        adminDO.setPassword(newHashPassword);
        return adminDAO.updateAll(adminDO);
    }

    @Override
    public Boolean checkCode(AdminDTO adminDTO) {
        Long enterpriseId = adminDTO.getEnterpriseId();
        String code = jedisUtil.get(RedisKeyConstants.ENTERPRISE_CHECK_CODE + enterpriseId);
        log.info("UserManager.checkCode enterprise.id : {} code is : {}", code);
        if(!adminDTO.getCode().equals(code)) {
            return false;
        }
        return true;
    }

    @Override
    public String contactsMobile(String mobile) {
        log.info("UserManager.contactsMobile account is : {}", mobile);
        List<AdminDO> adminDOS = adminDAO.selectByUserName(mobile);
        if(CollectionUtils.isNotEmpty(adminDOS)) {
            Long enterpriseId = adminDOS.get(0).getEnterpriseId();
            // 根据企业id查询联系人电话号码
            EnterpriseDO enterpriseDO = enterpriseDAO.selectById(enterpriseId);
            if(null == enterpriseDO) {
                throw new BusinessErrorException(BusinessCode.ACCOUNT_ENTERPRISE_NOT_EXIST);
            }
            return enterpriseDO.getMobile();
        }
        return "";
    }

    @Override
    public Integer unbind(CardDTO cardDTO) {
        return userDAO.unbind(cardDTO.getId());
    }

    @Override
    public Integer getSetting(Long enterpriseId) {
        return enterpriseDAO.selectById(enterpriseId).getIsOpen();
    }

    @Override
    @Transactional(rollbackFor = Throwable.class)
    public Integer deleteCard(Long id) {
        // 将user表逻辑删除
        // 根据cardId查询card信息
//        CardDO cardDO = cardDAO.selectById(id);
//        if(null != cardDO) {
//            Long baseInfoId = cardDO.getBaseInfoId();
//            // 删除card和baseInfo
//            cardDO.setIsDelete(1);
//            if(cardDAO.updateSelective(cardDO)) {
//                return cardBaseInfoDAO.deleteById(baseInfoId);
//            }
//        }
        return userDAO.updateDelete(id);
    }

    @Override
    public MyPageDTO getUserInfo(TokenParam tokenParam) {
        MemberDO memberDO = memberDAO.selectById(tokenParam.getMemberId());
        MyPageDTO dto = new MyPageDTO();
        dto.setName(memberDO.getNickname());
        dto.setAvatar(memberDO.getAvatar());
        dto.setMobile(memberDO.getMobile());

        //获取收藏夹名片数量
        Long cardNum = favoriteCardDAO.selectCountByMemberId(tokenParam.getMemberId());
        dto.setCardNum(cardNum);

        //判断企业版名片申请记录
        if (tokenParam.getEnterpriseId() > 0) {
            dto.setCompanyStatus(2);
        } else {
            MessageDO messageDO = messageDAO.selectByMemberId(tokenParam.getMemberId());
            if (messageDO != null && messageDO.getStatus() == 0) {
                dto.setCompanyStatus(1);
            } else {
                dto.setCompanyStatus(0);
            }
        }
        return dto;
    }

    @Override
    public PageDTO<CardListResponse> cardList(CardListParam cardListParam) throws ParseException {
        PageDTO<CardListResponse> pageDTO = new PageDTO<>();
        if(null != cardListParam) {
            CardListParamQuery cardListParamQuery = DataConvertUtils.
                    convertDO2DTO(cardListParam, CardListParamQuery.class);
            if(cardListParam.getCreatedStartAt() != null) {
                String stringDate = DateTimeUtils.longTransStringDate(cardListParam.getCreatedStartAt() * 1000);
                Date date = DateTimeUtils.formateTimeStart(stringDate);
                cardListParamQuery.setCreatedStartAt(date);
            }
            if(cardListParam.getCreatedEndAt() != null) {
                String stringDate = DateTimeUtils.longTransStringDate(cardListParam.getCreatedEndAt() * 1000);
                Date date = DateTimeUtils.formateTimeEnd(stringDate);
                cardListParamQuery.setCreatedEndAt(date);
            }
            if(cardListParam.getVerifyStartAt() != null) {
                String stringDate = DateTimeUtils.longTransStringDate(cardListParam.getVerifyStartAt() * 1000);
                Date date = DateTimeUtils.formateTimeStart(stringDate);
                cardListParamQuery.setVerifyStartAt(date);
            }
            if(cardListParam.getVerifyEndAt() != null) {
                String stringDate = DateTimeUtils.longTransStringDate(cardListParam.getVerifyEndAt() * 1000);
                Date date = DateTimeUtils.formateTimeEnd(stringDate);
                cardListParamQuery.setVerifyEndAt(date);
            }
            List<CardListResult> cardListResultList = cardDAO.cardList(cardListParamQuery);
            log.info("企业后台获取用户列表 : {}", JSON.toJSONString(cardListResultList));
            // 查询company信息
            if(CollectionUtils.isNotEmpty(cardListResultList)) {
                // 获取companyId列表
                List<Long> cardUserInfoIdList = cardListResultList.stream().map(CardListResult::getCardUserInfoId).collect(Collectors.toList());
                // 查询company_info列表
                if(CollectionUtils.isNotEmpty(cardUserInfoIdList)) {
                    List<CardUserCompanyInfoDO> cardUserCompanyInfoDOS = cardUserCompanyInfoDAO.selectByCardUserInfoIds(cardUserInfoIdList);
                    // list 转 map
                    Map<Long, List<CardUserCompanyInfoDO>> longListMap = cardUserCompanyInfoDOS.stream().collect(Collectors.groupingBy(CardUserCompanyInfoDO::getCardUserInfoId));
                    cardListResultList.forEach(cardListResult -> {
                        List<CardUserCompanyInfoDO> cardUserCompanyInfoDOList = longListMap.get(cardListResult.getCardUserInfoId());
                        List<CardUserCompanyInfoDTO> cardUserCompanyInfoDTOList = new ArrayList<>();
                        DataConvertUtils.convertDOList2DTOList(cardUserCompanyInfoDOList, cardUserCompanyInfoDTOList, CardUserCompanyInfoDTO.class);
                        // 查询公司
                        cardUserCompanyInfoDTOList.stream().forEach(cardUserCompanyInfoDTO -> {
                            CompanyDO companyDO = companyDAO.selectById(cardUserCompanyInfoDTO.getCompanyId());
                            if(null != companyDO) {
                                cardUserCompanyInfoDTO.setName(companyDO.getName());
                                cardUserCompanyInfoDTO.setNameEn(companyDO.getNameEn());
                            }
                        });
                        cardListResult.setCompanys(cardUserCompanyInfoDTOList);
                    });
                }
            }
            List<CardListResponse> cardListResponseList = new ArrayList<>();
            DataConvertUtils.convertDOList2DTOList(cardListResultList, cardListResponseList, CardListResponse.class);
            Integer count = cardDAO.count(cardListParamQuery);
            pageDTO.setCount(count);
            pageDTO.setData(cardListResponseList);
        }
        return pageDTO;
    }

    @Override
    public UserDetailResponse userDetail(Long id) {
        // 查询基础信息
        UserDetailResult userDetailResult = cardUserInfoDAO.userDetail(id);
        // 查询company信息和adress信息
        Long addressId = userDetailResult.getAddressId();
        Long cardUserInfoId = userDetailResult.getCardUserInfoId();
        List<CardUserCompanyInfoDO> cardUserCompanyInfoDOS = cardUserCompanyInfoDAO.selectByCardUserInfoIds(Arrays.asList(cardUserInfoId));
        AddressDO addressDO = addressDAO.selectById(addressId);
        // UserDetailResult 转 UserDetailResult
        UserDetailResponse userDetailResponse = DataConvertUtils.convertDO2DTO(userDetailResult, UserDetailResponse.class);
        // AddressDO 转 AddressDTO
        AddressDTO addressDTO = DataConvertUtils.convertDO2DTO(addressDO, AddressDTO.class);
        // 构建company
        List<CardUserCompanyInfoDTO> cardUserCompanyInfoDTOS = new ArrayList<>();
        if(CollectionUtils.isNotEmpty(cardUserCompanyInfoDOS)) {
            DataConvertUtils.convertDOList2DTOList(cardUserCompanyInfoDOS, cardUserCompanyInfoDTOS, CardUserCompanyInfoDTO.class);
        }
        List<Long> companyIdList = cardUserCompanyInfoDTOS.stream().map(CardUserCompanyInfoDTO::getCompanyId).collect(Collectors.toList());
        if(CollectionUtils.isNotEmpty(companyIdList)) {
            List<CompanyDO> companyDOS = companyDAO.selectByCompanyIdList(companyIdList);
            Map<Long, CompanyDO> longCompanyDOMap = companyDOS.stream().collect(Collectors.toMap(CompanyDO::getId, a -> a, (k1, k2) -> k1));
            cardUserCompanyInfoDTOS.stream().forEach(cardUserCompanyInfoDTO -> {
                CompanyDO companyDO = longCompanyDOMap.get(cardUserCompanyInfoDTO.getCompanyId());
                if(null != companyDO) {
                    cardUserCompanyInfoDTO.setName(companyDO.getName());
                    cardUserCompanyInfoDTO.setNameEn(companyDO.getNameEn());
                }
            });
        }

        userDetailResponse.setAddressInfo(addressDTO);
        userDetailResponse.setCardUserCompanyInfoDTOS(cardUserCompanyInfoDTOS);
        return userDetailResponse;
    }

    @Override
    @Transactional(rollbackFor = Throwable.class)
    public Long updateCard(CardSaveParam param) {
        log.info("UserManager.updateCard param is : {}", param);
        Long enterpriseId = param.getEnterpriseId();
        if (enterpriseId == null) {
            throw new BusinessErrorException(BusinessCode.ACCOUNT_ENTERPRISE_EXCEPTION);
        }

        EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseDTO(param.getEnterpriseId());
        if (enterpriseDTO == null) {
            throw new BusinessErrorException(BusinessCode.ACCOUNT_ENTERPRISE_NOT_EXIST);
        }

        // 构建card_user_info
        CardUserInfoDO cardUserInfoDO = cardUserInfoDAO.selectOneByUserId(param.getId());

        TextCheckRequest request = new TextCheckRequest();
        request.setName(param.getName());
        request.setDepartment(param.getDepartment1Name());
        request.setJob(param.getJob1Name());
        request.setOtherDepartment(param.getDepartment2Name());
        request.setOtherJob(param.getJob2Name());
        request.setUserId(cardUserInfoDO.getUserId());
        textCheckService.textCheck(request,param.getEnterpriseId(),SourceTypeEnum.ENTERPRISE_BACKEND.getValue());

        cardUserInfoDO.setName(param.getName());
        cardUserInfoDO.setNameEn(param.getNameEn());
        cardUserInfoDO.setMobile(param.getMobile1());
        cardUserInfoDO.setAddressId(param.getAddressId());
        cardUserInfoDO.setEmail(param.getEmail());
        cardUserInfoDAO.updateSelective(cardUserInfoDO);
        // 构建card_user_company_info
        // 公司1
        List<CardUserCompanyInfoDO> cardUserCompanyInfoDOS = cardUserCompanyInfoDAO.selectByCardUserInfoId(cardUserInfoDO.getId());
        if(CollectionUtils.isNotEmpty(cardUserCompanyInfoDOS)) {
            CardUserCompanyInfoDO cardUserCompanyInfoDO1 = new CardUserCompanyInfoDO();
            cardUserCompanyInfoDO1.setId(cardUserCompanyInfoDOS.get(0).getId());
            cardUserCompanyInfoDO1.setCompanyId(param.getCompany1());
            cardUserCompanyInfoDO1.setJob(param.getJob1Name());
            cardUserCompanyInfoDO1.setDepartment(param.getDepartment1Name());
            cardUserCompanyInfoDO1.setCardUserInfoId(cardUserInfoDO.getId());
            cardUserCompanyInfoDAO.updateSelective(cardUserCompanyInfoDO1);

            if(cardUserCompanyInfoDOS.size() == 2) {
                // 公司2
                CardUserCompanyInfoDO cardUserCompanyInfoDO2 = new CardUserCompanyInfoDO();
                cardUserCompanyInfoDO2.setId(cardUserCompanyInfoDOS.get(1).getId());
                cardUserCompanyInfoDO2.setCompanyId(param.getCompany2());
                cardUserCompanyInfoDO2.setJob(param.getJob2Name());
                cardUserCompanyInfoDO2.setDepartment(param.getDepartment2Name());
                cardUserCompanyInfoDO2.setCardUserInfoId(cardUserInfoDO.getId());
                cardUserCompanyInfoDAO.updateSelective(cardUserCompanyInfoDO2);
            }
        }
        return param.getUserId();
    }

    @Override
    public Long expireDays(Long enterpriseId) {
        // 根据企业id查询企业信息
        EnterpriseDO enterpriseDO = enterpriseDAO.selectById(enterpriseId);
        // 判断过期日期是否大于当前日期
        if(null != enterpriseDO && enterpriseDO.getExpirationAt().getTime() > new Date().getTime()) {
            return -1L;
        }
        // 计算到期的天数
        return DateTimeUtils.days(enterpriseDO.getExpirationAt());
    }

    @Override
    @Transactional(rollbackFor = Throwable.class)
    public void updateCheckStatus(Long cardUserId, Integer checkStatus) {
        CardUserInfoDO cardUserInfoDO = cardUserInfoDAO.selectById(cardUserId);
        UserDO userDO = userDAO.selectById(cardUserInfoDO.getUserId());
        userDO.setCheckStatus(checkStatus);
        userDO.setCheckRemark("");
        userDAO.updateSelective(userDO);

        UserInfoCheckResultDO userInfoCheckResultDO = userInfoCheckResultDAO.selectByUserId(cardUserInfoDO.getUserId());
        if (userInfoCheckResultDO != null) {
            userInfoCheckResultDO.setName(0);
            userInfoCheckResultDO.setCompany(0);
            userInfoCheckResultDO.setOtherCompany(0);
            userInfoCheckResultDO.setDepartment(0);
            userInfoCheckResultDO.setOtherDepartment(0);
            userInfoCheckResultDO.setJob(0);
            userInfoCheckResultDO.setOtherJob(0);
            userInfoCheckResultDO.setAddress(0);
            userInfoCheckResultDO.setForwardTitle(0);
            userInfoCheckResultDO.setVisitorTitle(0);
            userInfoCheckResultDAO.updateSelective(userInfoCheckResultDO);
        }
    }

}
